import os
import shutil
from utils.project_path import config


def clear_report_data(path):
    files = os.listdir(path)
    for file in files:
        c_path = os.path.join(path, file)
        if os.path.isdir(c_path):
            shutil.rmtree(c_path)
        else:
            if "environment.properties" not in c_path:
                os.remove(c_path)


if __name__ == '__main__':

    clear_report_data(config.report_path)
    os.system("pytest") # windows使用
    # os.system("python3 -m pytest") # linux使用
    os.system("allure generate report -o report/result --clean")
